﻿define(function (require) {
    var router = require('plugins/router'),
        hubService = require('modules/hubService');

    return {
        router: router,
        hubService: hubService,
        activate: function () {

            //router.handleInvalidRoute = function () {
            //    logger.error("Invalid route");
            //    router.navigateTo(router.visibleRoutes()[0].hash);
            //};
            router.map([
               { route: '', title: 'Orders', moduleId: 'viewmodels/order/list', nav: true },
               { route: 'customer/list', title: 'Customers', moduleId: 'viewmodels/customer/list', nav: true },
               { route: 'customer/edit/:id', title: 'Edit Customer', moduleId: 'viewmodels/customer/edit', nav: false },
               { route: 'order/edit', title: 'Edit Order', moduleId: 'viewmodels/order/edit', nav: false },
               { route: 'order/edit/:id', title: 'Edit Order', moduleId: 'viewmodels/order/edit', nav: false },
               { route: '', moduleId: 'viewmodels/order/customerSelection', nav: false },
            ]).buildNavigationModel();

            return router.activate('order/list');
        }

    };
});